package com.nbsaas.boot.shop.rest.convert;

import com.nbsaas.boot.shop.data.entity.ShopApp;
import com.nbsaas.boot.shop.api.domain.response.ShopAppResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* -实体对象转化成响应对象
*/

public class ShopAppResponseConvert  implements Converter<ShopAppResponse,ShopApp> {

    @Override
    public ShopAppResponse convert(ShopApp source) {
        ShopAppResponse  result = new  ShopAppResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getShop()!=null){
                        result.setShop(source.getShop().getId());
                    }

                    try {
                        if(source.getShop()!=null){
                            result.setShopName(source.getShop().getName());
                        }
                    } catch (Exception ignored) { }

                    if(source.getStaff()!=null){
                        result.setStaff(source.getStaff().getId());
                    }
        return result;
    }

}

